package org.yenn.pattern.aliyun.structural.filtercriteria.impl;

import org.yenn.pattern.aliyun.structural.filtercriteria.Criteria;
import org.yenn.pattern.aliyun.structural.filtercriteria.Person;

import java.util.ArrayList;
import java.util.List;

/**
 * 步骤 3
 * 创建实现了 Criteria 接口的实体类。
 */
public class CriteriaFemale implements Criteria {
    @Override
    public List<Person> meetCriteria(List<Person> persons) {
        List<Person> malePersons = new ArrayList<>();
        for (Person person : persons) {
            if(person.getGender().equalsIgnoreCase("FEMALE")){
                malePersons.add(person);
            }
        }
        return malePersons;
    }
}
